package com.ido.exception;

/**
 * 业务异常
 */
public class BizException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    /**
     * 错误码
     */
    private Integer code;


    public BizException(String message) {
        super(message);
        this.code = BaseResult.FAILURE.getCode();
    }

    public BizException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public BizException(IResult iResult) {
        super(iResult.getMsg());
        this.code = iResult.getCode();
    }

    public BizException(IResult iResult, Object... params) {
        super(String.format(iResult.getMsg(), params));
        this.code = iResult.getCode();
    }

    public Integer getCode() {
        return code;
    }

}
